﻿namespace Example.Runtime.Serialization
{
    using System.Text;
    using Xunit;

    public class SoapSerializerFacts
    {
        [Fact]
        public void op_ToString_object()
        {
            var expected = new StringBuilder();
            expected.AppendLine("<SOAP-ENV:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:clr=\"http://schemas.microsoft.com/soap/encoding/clr/1.0\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">");
            expected.AppendLine("<SOAP-ENV:Body>");
            expected.AppendLine("<SOAP-ENC:string id=\"ref-1\">test</SOAP-ENC:string>");
            expected.AppendLine("</SOAP-ENV:Body>");
            expected.AppendLine("</SOAP-ENV:Envelope>");

            var actual = SoapSerializer.ToString("test");

            Assert.Equal(expected.ToString(), actual);
        }

        [Fact]
        public void op_ToString_objectNull()
        {
            Assert.Null(SoapSerializer.ToString(null));
        }
    }
}